﻿<%@ Page Language="C#" MasterPageFile="~/Admin/Admin.master" AutoEventWireup="true" CodeFile="adm_user_list.aspx.cs" Inherits="adm_user_list" Title="Untitled Page" %>
<%@ Register src="../UserControls/AdminPagingListing.ascx" tagname="AdminPagingListing" tagprefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
<style type="text/css">
        @import url(js/calendar-blue.css);
    </style>
    <script type='text/javascript' src="js/calendar.js"></script>
    <script type='text/javascript' src="js/calendar-en.js"></script>
    <script type='text/javascript' src="js/calendar-setup.js"></script>
    <script language="javascript" src="js/scw.js"></script>
    <script type='text/javascript'>
        function openWin(aid)
        {
            var url="../Admin/adm_user_edit_win.aspx?aid="+aid;
            window.open(url,"child","scrollbars,width=420,height=430");
        }
    </script>
		<div class="adm-wrap">
					<h3>
					    User edit
					</h3>
					<div class="article">
						<p class="hi"><asp:Label ID="lblGretting" Text="Hi admin Khuong luu" runat="server"></asp:Label></p>
						<p class="hi"><asp:Label ID="lblAlert" runat="server" style="border:solid 1px Gray;padding:3px" Text="aaaaaaaaa" Visible="false"></asp:Label></p>
						<table width="100%" border="0" cellspacing="0" cellpadding="0" style="border:0px;">
							<tr>
								<td>
    								<table width="100%" border="0" cellspacing="0" cellpadding="0" style="border:0px">
									<tr>
										<td class="clstitle">Search By:</td>
									</tr>
									<tr>
										<td><asp:DropDownList ID="ddlSearchBy" runat="server" CssClass="medium_ex" 
                                                Width="160px">
                                                <asp:ListItem Value="Login_Email">Login E-mail</asp:ListItem>
                                                <asp:ListItem Value="Firstname">Firstname</asp:ListItem>
                                                <asp:ListItem Value="Lastname">Lastname</asp:ListItem>
                                            </asp:DropDownList>
                                            <asp:Button ID="btnSearch" runat="server" CssClass="submitbutton" Text="Search" onclick="btnSearch_Click" Width="80px" />
                                        </td>
									</tr>
									<tr>
										<td>
                                            <asp:TextBox ID="txtSearchBy" runat="server" CssClass="medium_ex" Width="153px"></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                                                ControlToValidate="txtSearchBy" ErrorMessage="Enter text to start search"></asp:RequiredFieldValidator>
                                        </td>
									</tr>
								</table>
								</td>
								<td>
									<table width="100%" border="0" cellspacing="0" cellpadding="0" 
                                        bgcolor="#e55a5d" style="padding: 0px; border: 0px;">
										<tr>
											<td class="clstitle">&nbsp; Filter By:</td>
											<td class="clstitle">&nbsp; Sort By:</td>
										</tr>
										<tr>
										    <td style="padding: 0; marign: 0;">
										        <table style="border:0px;" cellpadding='0' cellspacing='0'><tr>
										        <td>&nbsp;</td><td style="padding: 0">
                                                <asp:TextBox ID="txtDateFrom" runat="server" CssClass="medium" Width="100px"></asp:TextBox>
                                                </td><td style="padding: 0">
                                                <img id='btnCalendarFrom' class="medium" src="../images/ico_calenda.gif" alt="thoi trang"  
                                                 style="cursor:pointer;" />
                                                 <script type="text/javascript">
                                                                  Calendar.setup(
                                                                    {
                                                                      inputField  : '<%= txtDateFrom.ClientID %>',         // ID of the input field
                                                                      ifFormat    : "%d/%m/%Y",    // the date format
                                                                      button      : "btnCalendarFrom"       // ID of the button
                                                                    }
                                                                  );
                                                                </script>
                                                </td></tr></table>
                                                </td>
											<td style="padding: 0">
											    <asp:DropDownList ID="ddlSortBy" runat="server" CssClass="small" Width="100px">
                                                    <asp:ListItem Value="">Sort by</asp:ListItem>
                                                    <asp:ListItem Value="Login_Email">Login E-mail</asp:ListItem>
                                                    <asp:ListItem>Firstname</asp:ListItem>
                                                    <asp:ListItem>Lastname</asp:ListItem>
                                                </asp:DropDownList>
                                            </td>
										</tr>
										<tr>
											<td nowrap="nowrap">
											    <table style="border:0px;" cellpadding='0' cellspacing='0'>
											        <tr>
											            <td>&nbsp;</td>
											            <td style="padding: 0"> <asp:TextBox ID="txtDateTo" runat="server" CssClass="medium" Width="100px"></asp:TextBox></td>
											            <td style="padding: 0">
                                                            <img id='btnCalendarTo' class="medium" src="../images/ico_calenda.gif" alt="thoi trang"  
                                                 style="cursor:pointer;" />
                                                 <script type="text/javascript">
                                                      Calendar.setup(
                                                        {
                                                          inputField  : '<%= txtDateTo.ClientID %>',         // ID of the input field
                                                          ifFormat    : "%d/%m/%Y",    // the date format
                                                          button      : "btnCalendarTo"       // ID of the button
                                                        }
                                                      );
                                                    </script></td>
											        </tr>
											    </table>
											
											</td>
											<td nowrap="nowrap" style="padding: 0px;">
											    <table style="border:0px;">
											        <tr>
											            <td><asp:DropDownList ID="ddlSortOrder" runat="server" CssClass="small" 
                                                                Width="100px">
                                                                <asp:ListItem Value="">Sort Order
                                                                </asp:ListItem>
                                                                <asp:ListItem Value="ASC">A-Z</asp:ListItem>
                                                                <asp:ListItem Value="DESC">Z-A</asp:ListItem>
                                                            </asp:DropDownList>
                                                        </td>
											            <td> 
                                                            <asp:Button ID="btnFillter" runat="server" CssClass="submitbutton" 
                                                                Text="Fillter" onclick="btnFillter_Click" Width="70px" 
                                                                CausesValidation="False" />
                                                        </td>
											            <td>
											                <asp:Button ID="btnReset" runat="server" CssClass="submitbutton" Text="Reset" 
                                                                onclick="btnReset_Click" Width="70px" CausesValidation="False" /></td>
											        </tr>
											    </table>
                                                </td>
										</tr>
									</table>
								</td>
							</tr>
							<tr>
								<td>
									<input class="submitbutton" name="commit" 
                                        onclick='javascript:SelectAllCheckBox();'  value="Check All" 
                                        style="width: 80px" />&nbsp;
									<input class="submitbutton" name="commit" 
                                        onclick='javascript:DeselectAllCheckBox();' value="UnCheck All" 
                                        style="width: 80px" />&nbsp;
								    <script type='text/javascript'>
								        function SelectAllCheckBox()
								        {
								            var arrChk= document.getElementById('selectAllCheckBox').getElementsByTagName("input");
								          
								            for(var i=0;i<arrChk.length;i++)
								            {
								                if(arrChk[i].id.indexOf("chkSelect")>0)
								                {								                 
								                    arrChk[i].checked=true;
								                }
								            }								        
								        }
								        function DeselectAllCheckBox()
								        {
								            var arrChk= document.getElementById('selectAllCheckBox').getElementsByTagName("input");
								            for(var i=0;i<arrChk.length;i++)
								            {
								                if(arrChk[i].id.indexOf("chkSelect")>0)
								                {
								                    arrChk[i].checked=false;
								                }
								            }	
								        }
								    </script>	
							    </td>
								<td colspan="2" align="right">
                                    <asp:Button ID="btnUpdate" runat="server" CssClass="submitbutton" Text="Update" 
                                        onclientclick="return confirm('Are you want to update batch of users?')" 
                                        Width="90px" CausesValidation="False" onclick="btnUpdate_Click" />
                                    <asp:Button ID="btnDelete" runat="server" CssClass="submitbutton" Text="Delete" 
                                        onclick="btnDelete_Click" 
                                        onclientclick="return confirm('Are you want to Delete?')" Width="90px" 
                                        CausesValidation="False"/>
								</td>
								</tr>
					
						</table> 
						<br />
						<div id='selectAllCheckBox'>
						<table style="border:0px; width:100%;">
						    <tr>
						        <td style="width:50%; ">
						            <asp:Literal ID="ltrStatic" runat='server'></asp:Literal>
						        </td>
						        <td  style="width:50%; text-align:center;">
			            
						            <uc1:AdminPagingListing ID="AdminPagingListing1" runat="server" />
			            
						        </td>
						    </tr>
						    <tr>
						        <td colspan='2'>
						            <asp:GridView ID="grvSearchResult" runat="server" AutoGenerateColumns="False"
						             DataKeyNames="UserID,UserTypeID" GridLines="None" Width="100%" 
                                        onrowdatabound="grvSearchResult_RowDataBound" BorderWidth="1px">
                                        <Columns>
                                            <asp:TemplateField>
                                                <ItemTemplate>
                                                    <asp:CheckBox ID="chkSelect" runat="server" />
                                                </ItemTemplate>
                                                <ItemStyle Width="16px" HorizontalAlign="Center"/>
                                            </asp:TemplateField>
                                            <asp:TemplateField>
                                                <ItemTemplate>
                                                    <a href='javascript:openWin(<%# Eval("UserID") %>)'>
                                                        <img src='../images/ico_edit.gif' alt='edit' />
                                                    </a>
                                                </ItemTemplate>
                                                <ItemStyle Width="30px" />
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Login E-mail">
                                                <ItemTemplate>
                                                    <%# Eval("Login_Email")%>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Firstname">
                                                <ItemTemplate>
                                                    <%# Eval("Firstname")%>
                                                </ItemTemplate>
                                                <ItemStyle Width="79px" />
                                                <HeaderStyle Wrap="False" />
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Lastname">
                                                <ItemTemplate>
                                                    <%# Eval("Lastname")%>
                                                </ItemTemplate>
                                                <ItemStyle Width="79px" />
                                                <HeaderStyle Wrap="False" />
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Gender">
                                                <ItemTemplate>
                                                    <%# Eval("Gender")%>
                                                </ItemTemplate>
                                                <HeaderStyle Wrap="False" />
                                                <ItemStyle Width="79px" />
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Member since">
                                                <ItemTemplate>
                                                    <%# Convert.ToDateTime(Eval("DateOpen")).ToString("MM/dd/yy")%>
                                                </ItemTemplate>
                                                <HeaderStyle Wrap="False" />
                                                <ItemStyle Width="79px" />
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="User Type">
                                                <ItemTemplate>
                                                    <asp:Label ID="lblUserType" runat="server" Visible="false" Text='<%# Eval("UserTypeID")%>'></asp:Label>
                                                    <asp:DropDownList ID="drpUserType" runat="server">
                                                        <asp:ListItem Value="2">Approver</asp:ListItem>
                                                        <asp:ListItem Value="3">Editor</asp:ListItem>
                                                        <asp:ListItem Value="4">Author</asp:ListItem>
                                                        <asp:ListItem Value="5">Reader</asp:ListItem>
                                                    </asp:DropDownList>
                                                </ItemTemplate>
                                                <HeaderStyle Wrap="False" />
                                                <ItemStyle Width="79px" />
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Access Article Featured">
                                                <ItemTemplate>
                                                    <asp:CheckBox ID="chk" runat="server" Checked='<%# Eval("IsAccessFeatured") %>' />
                                                </ItemTemplate>
                                                <ItemStyle Width="79px" />
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Status">
                                                <ItemTemplate>
                                                    <asp:Label ID="lblStatus" runat="server" Text='<%# Eval("IsActive") %>'></asp:Label>
                                                </ItemTemplate>
                                                <ItemStyle Width="89px" />
                                            </asp:TemplateField>
                                        </Columns>
                                        <HeaderStyle CssClass="first" />
                                        <AlternatingRowStyle CssClass="second_se" />
                                    </asp:GridView>
						        </td>
						    </tr>
						    <tr>
						        <td style="width:50%; text-align:center;">
						        </td>
						        <td  style="width:50%; text-align:center;">
			            
						            <uc1:AdminPagingListing ID="AdminPagingListing2" runat="server" />
			            
						        </td>
						    </tr>
						    </table>
						</div>
						
					</div>
				</div>
</asp:Content>

